package 集合进阶.单列集合.List集合.Set集合.TreeSet.练习;

import java.util.Collection;
import java.util.TreeSet;

public class Text {
    public static void main(String[] args) {
        //创建5个学生对象
        Student stu1=new Student("zhangsan",23,90,99,50);
        Student stu2=new Student("lisi",24,90,98,50);
        Student stu3=new Student("wangwu",24,90,98,50);
        Student stu4=new Student("zhaoliu",26,60,99,70);
        Student stu5=new Student("qianqi",26,70,80,70);

        //2.创建集合对象
        Collection<Student> coll= new TreeSet<>();

        //3.添加对象到集合中
        coll.add(stu1);
        coll.add(stu2);
        coll.add(stu3);
        coll.add(stu4);
        coll.add(stu5);

        //4.打印集合
        coll.forEach(student -> System.out.println(student));
    }
}
